﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Apex.Common
{
    public class LatLon
    {
        public double Lat { get; set; }
        public double Lon { get; set; }

        public LatLon()
        {
            Lat = Lon = 0;
        }

        public LatLon(string lat, string lon)
        {
            try
            {
                Lat = double.Parse(lat);
                Lon = double.Parse(lon);
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException(string.Format("Latitude or longitude not in a propper format: Lat = {0}, Lon = {1}", lat, lon), ex);
            }
        }

        public LatLon(double lat, double lon)
        {
            Lat = lat;
            Lon = lon;
        }

        public override string ToString()
        {
            return string.Format("[{0}, {1}]", Lat, Lon);
        }
    }

}
